import {get, getList, post} from './request'

// ..................账号相关..........................
// 注册
export const register = params => post('account/register/', params);
// 登录
export const loginIn = params => post('account/login/', params);
// 登出
export const logOut = () => get('account/log-out/');
// 修改密码
export const changePass = params => post('account/change-password/', params);
// 用户信息
export const userInfo = params => get('account/user-info/', params);
// 更新用户信息
export const updateUserInfo = params => post('account/update-user-info/', params);
// 上传头像
export const uploadAvatar = params => post('account/upload-avatar/', params);
// 获取分类
export const listClassify = () => get('account/list-classify/');
// 创建分类
export const createClassify = params => post('account/create-classify/', params);
// 创建标签
export const createTag = params => post('account/create-tag/', params);
// 获取标签
export const listTags = params => get('account/list-tag/', params);
// 删除标签
export const delTag = params => getList('account/delete-tag/', params);
// 修改标签
export const modifyTag = params => post('account/modify-tag/', params);
// 关注用户
export const attentionUser = username => get(`account/attention-user/?username=${username}`);
// 获取用户粉丝数
export const getUserFansCount = username => get(`account/get-fans-count/?username=${username}`);
// 取消关注用户
export const cancelAttentionUser = username => get(`account/cancel-attention-user/?username=${username}`);
// 查看所有已关注的用户
export const listAttentionUser = params => get('account/list-attention-user/', params);
// 查看当前用户是否关注了此用户
export const checkAttentionInfo = username => get(`account/check-attention-info/?username=${username}`);
// 收藏文章
export const collectArticle = articleID => get(`account/collect-article?article_id=${articleID}`);
// 取消收藏文章
export const cancelCollectArticle = params => getList('account/cancel-collect-article', params);
// 收藏文章列表
export const listCollectArticle = params => get('account/list-collect-article/', params);

// ..................文章相关............................
// 上传(更新)文章
export const uploadArticle = params => post('article/upload-article/', params);
// 获取指定文章的内容
export const getArticle = id => get(`article/get-article?id=${id}`);
// 获取所有文章列表 可指定用户（可选）
export const listArticle = params => get('article/list-article/', params);
// 获取自己的文章列表
export const listSelfArticle = params => get('article/list-self-article/', params);
// 删除文章
export const deleteArticle = params => getList('article/delete-article/', params);
// 修改文章
// export const modifyArticle = params => post('article/modify')
// 获取关注的用户的文章列表
export const listStaredUserArticle = params => get('article/list-star-user-article/', params);
// 评论
export const commentArticle = params => post('article/comment-article/', params);
// 获取评论列表
export const listArticleComment = params => get('article/list-article-comment/', params);
// 获取评论列表
export const listArticleChildComment = params => get('article/list-article-child-comment/', params);
// 评论点赞
export const articleCommentUp = comment_id => get(`article/article-comment-up/?comment_id=${comment_id}`);

